package synchronicity.agent;

import synchronicity.util.Range;

/**
 * The AgentFactory is used to create agents of various types during
 * serialization
 */
public class AgentFactory {
	public static Agent createNewAgent(String type){
		Agent agent = null;
		if(type.equals(ScheduleCollectorAgent.TYPE)){
			agent = new ScheduleCollectorAgent();
		}
		else if(type.equals(SchedulerAgent.TYPE)){
			agent = new SchedulerAgent(new Range(0,0),"");
		}
		else {
			throw new IllegalArgumentException("Invalid agent type :"+type);
		}
		return agent;
	}
}
